﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Mapping;
using WebSite.Model;

namespace WebSite.Data.NH.Repositories.Mappings
{


    public class ContentInfoMap : ClassMap<ContentInfo>
    {

        public ContentInfoMap()
        {
            Table("ContentInfo");
            LazyLoad();
            Id(x => x.ContentId).GeneratedBy.Identity().Column("ContentId");
            Map(x => x.CompanyId).Column("CompanyId").Not.Nullable();
            Map(x => x.CategoryId).Column("CategoryId").Not.Nullable();
            Map(x => x.Title).Column("Title");
            Map(x => x.AdminUserId).Column("AdminUserId");
            Map(x => x.AdminUserName).Column("AdminUserName");
            Map(x => x.ReleaseDate).Column("ReleaseDate");
            Map(x => x.ReadCount).Column("ReadCount");
            Map(x => x.CommentsCount).Column("CommentsCount");
            Map(x => x.ImgUrl).Column("ImgUrl");
            HasOne<ContentDetailInfo>(x => x.ContentDetail).Cascade.All();
        }
    }

}
